<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%-- 
    JSP Name : jspName.jsp
    Description : 설명을 기술합니다.
    author Seung Won
    since 2012. 8. 9.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 8. 9.     Seung Won     최초 생성
--%>
<%@ include file="/WEB-INF/jsp/co/mn/include/declare.jspf" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">
<head>
<title>HMC GLOBAL CSR</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<%@ include file="/WEB-INF/jsp/co/mn/include/header.jspf" %>
<script type="text/javaScript" language="javascript">
<!--
$(document).ready(function() {
    /* form validation check */
    onloadCharCheck();
    
    $("#srchButn").bind("click", moveSearch);    // 검색
    $("#srchAdr").bind("keydown", eventEnter);    // 엔터키 제어
});

/*
 * 검색 Text EnterKey 처리
 */
function eventEnter() {
    if (event.key == 13) {
        moveSearch();
    }
}

/*
 * 검색
 */
function moveSearch() {
    
    if (!isSchrChk($("#srchAdr").val())) {
        alert("검색어에는 특수문자를 입력할 수 없습니다.");
        $("#srchAdr").focus();
        return false;
    }
    
    if($("#srchAdr").val().length == 0) {
        alert("검색어를 입력해주세요.");
        $("#srchAdr").focus();
        return false;
    }
    
    $("#mainForm").attr('target','_self');
    $("#mainForm").attr('action','/CO000013.do').submit();
}


/*
 * 주소지 선택
 */
function insertAdr(argZip, argAdr) {
    
    $("#zip1", opener.document).val(argZip.substring(0,3));
    $("#zip2", opener.document).val(argZip.substring(4,7));
    $("#adrBasc", opener.document).val(argAdr);
    $("#adrDtl", opener.document).val("");
    
    self.close();
} 

//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HMC GLOBAL CSR</title>
</head>
<body>
<div class="popZipWrap">
    <div class="zipHead"><h3><img src="/img/mng/common/h3_zip.gif" alt="우편번호 찾기" /></h3></div>
    <div class="zipContents">
        <p class="subMsg"><strong>찾고자 하는 주소의 동/읍/면 이름을 입력하세요.</strong></p>
        <div class="searchZip">
             <form id="mainForm" name="mainForm" method="post">
                <fieldset>
                    <legend class="invisible">Zip Code Search</legend>
                    <img src="/img/mng/common/img_zip_1.gif" alt="지역명 검색" /><input type="text" class="formSearch" id="srchAdr" name="srchAdr" value="${rqInfo.srchAdr }" title="검색어입력" maxlength="10" /><input type="image" onclick="return false;" id="srchButn" class="btnSearch" src="/img/mng/btn/btn_search.gif" alt="검색" title="검색" />
                </fieldset>
            </form>
            <p class="example">(예 : 대치동, 곡성읍, 오곡면)</p>
        </div>
        <p class="resultTxt">검색 결과 중 해당 주소를 클릭하시면 자동 입력됩니다.</p>
        <table border="1" class="resultTable" summary="우편번호 검색 결과 표">
            <colgroup>
                <col width="20%" />
                <col width="80%" />
            </colgroup>
            <thead>
                <tr>
                    <th>우편번호</th>
                    <th>주소</th>
                </tr>
            </thead>
            <tbody>
                <c:choose>
                        <c:when test="${resultList != null && !empty resultList }">
                            <c:forEach var="result" items="${resultList }" varStatus="status">
                <tr>
                    <td>${result.zip }</td>
                    <td class="dirLeft"><a href="javascript:insertAdr('${result.zip }','${result.admp } ${result.admz } ${result.dong } ${result.hno }')">${result.admp } ${result.admz } ${result.dong } ${result.hno }</a></td>
                </tr>
                            </c:forEach>
                        </c:when>
                        <c:otherwise>
                <tr>
                    <td colspan="2">등록된 내용이 없습니다.</td>
                </tr>
                        </c:otherwise>
                </c:choose>
            </tbody>
        </table>
        <p class="zipClose"><input type="image" src="/img/mng/btn/btn_zip_close.gif" alt="닫기" title="닫기" onclick="javascript:window.close();" /></p>
    </div>
</div>
</body>
</html>

